package com.hunt.controller;


import com.hunt.model.dto.PageInfo;
import com.hunt.model.entity.BaseData;
import com.hunt.model.entity.StockBasicSimple;
import com.hunt.service.GetStockBasicService;
import com.hunt.service.StockBaseService;
import com.hunt.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: ww
 * @Date: 2020-9-16 17:30
 * @Description:
 */

@Api(value = "手机app端, 股票基本信息模块")
@Controller
@RequestMapping(path = "/app/stockBase")
public class StockBaseController extends BaseController {
    @Autowired
    private  GetStockBasicService  getStockBasicService;
    @Resource
    private StockBaseService tsCodeService;

    @ApiOperation(value = "查找股票和板块基本信息", httpMethod = "GET", produces = "application/json", response = Result.class)
    @ResponseBody
    @RequestMapping(value = "findStockBaseByCode", method = RequestMethod.GET)
    public Result findStockBaseByCode(@RequestParam(value = "code") String code) {

        List<StockBasicSimple> stockBasicList = tsCodeService.findStockBaseByCode(code);

        return Result.success(stockBasicList);
    }
    @ResponseBody
    @RequestMapping("findByTsCode")
    @ApiOperation(value = "基础数据", httpMethod = "GET", produces = "application/json", response = PageInfo.class)
    public Result getStockBasic(@RequestParam("code")String code){
        return Result.success(getStockBasicService.findByTsCode(code));
    }
}